/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package connection;

import java.sql.*;
import java.util.*;

import com.mysql.jdbc.Driver;
/**
 *
 * @author ozgencetinkaya
 */
public class ConnectionManager {
    
    static Connection con;
	static String url;
	static String databaseName;
        
    
    public static Connection getConnection()
    {
        
        try
        {
        	String url = "jdbc:mysql://" + "titan.cmpe.boun.edu.tr:3306/"; 	// Assuming "DataSource" is your DataSource name
        	String databaseName = "database7";
        	String driver = "com.mysql.jdbc.Driver";
        	String userName = "project7"; 
        	String password = "k56si";
        	
        	
        	Class.forName(driver).newInstance();
            
            try
            {    
            	
                con = DriverManager.getConnection(url+databaseName,userName,password); 
                										// Assuming your SQL Server's	username is "username"
                										// And password is "password"
                 
            }
            
            catch (SQLException ex)
            {
                ex.printStackTrace();
            }
        }
        catch(Exception e)
        {
            System.out.println(e);
        }
        return con;
    }

}
